package com.spirit.mypopup.menu.adapter;

import com.spirit.mypopup.menu.FragmentDouble;
import com.spirit.mypopup.menu.FragmentFlite;
import com.spirit.mypopup.menu.MenuType;
import com.spirit.mypopup.menu.OptionObject;
import com.spirit.mypopup.menu.OptionTitleInterface;

import java.util.List;

/**
 * author : fang.zhang
 * e-mail : initzf@126.com
 * date   : 2020/5/17
 * desc   :
 */
public class MenuFliteAdapter implements BaseMenuAdapter {

    private int mType;
    private List<? extends OptionObject> mData;
    private OptionTitleInterface mTitleInterface;

    public MenuFliteAdapter(int type, OptionTitleInterface mTitleInterface, List<? extends OptionObject> data) {
        this.mType = type;
        this.mData = data;
        this.mTitleInterface = mTitleInterface;
    }

    @Override
    public int getType() {
        return mType;
    }

    @Override
    public OptionTitleInterface getTitle() {
        return mTitleInterface;
    }

    @Override
    public List<? extends OptionObject> getDatas() {
        return mData;
    }

    @Override
    public BaseMenuFragment getFragment() {
        if (getType() == MenuType.SIGIN_MENU) {
            return FragmentFlite.newInstance(getDatas());
        } else {
            return FragmentDouble.newInstance(getDatas());
        }
    }
}
